<?php
require_once "./db_config.php";
if(isset($_POST['name'])){
    $name=$_POST['name'];
    $sql="SELECT layoutJSON from dynamic_form WHERE name='$name'";
    $result=mysqli_query($conn,$sql);
    if(! $result )
    {
        die('error: ' . mysqli_error($conn));
    }else{
        if(mysqli_num_rows($result) > 0) {
            $row = mysqli_fetch_assoc($result);
            echo $row['layoutJSON'];
        }else{
            echo "error";
        }
    }
}
mysqli_close($conn);
